package com.zm.rpc.server.serializer;

import com.zm.rpc.protocol.enums.SerialType;
public interface ISerializer {
    
    public static final ISerializer JSON_SERIALIZER = new JsonSerializer();


    <T> byte[] serialize(T obj);

    <T> T deserialize(byte[] data,Class<T> clazz);

    public static ISerializer getSerializer(byte serialType){
        
        if( serialType == SerialType.JSON_SERIAL.code()){
            return JSON_SERIALIZER;
        }

        return JSON_SERIALIZER;

    }
}
